<?php
/**
 * Created by PhpStorm.
 * User: chenxiang
 * Date: 2017/4/27
 * Time: 10:15
 */

namespace App\Model;


class Json
{
    static $error;

    static function error($data,$msg=''){
        return array(
            'status'=>0,
            'msg'=>$msg?$msg:'请求失败',
            'data'=>$data
        );
    }

    static function success($data,$msg=''){
        return array(
            'status'=>1,
            'msg'=>$msg?$msg:'请求成功',
            'data'=>$data
        );
    }

//    static function getError(){
//        return self::$error;
//    }
//
//    static function setError($error){
//        self::$error = $error;
//    }

    static function ErrorFrist(array $error){
        do{
            $error = current($error);
        }while(is_array($error));
        return $error;
    }
}